import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import app from '@/store/modules/app'
import dict from '@/store/modules/dict'
import user from '@/store/modules/user'
import im from '@/store/modules/im'
import homework from '@/store/modules/homework'
import wqBook from '@/store/modules/wq-book'
import exerciseCenter from '@/store/modules/exercise-center'
import learning from '@/store/modules/learning'
import dailyAttendance from '@/store/modules/daily-attendance'
import sw from '@/store/modules/service-worker'
import correctEnglish from '@/store/modules/correct-english'
import { moduleUse } from '@/store/modules/module-use'
import dictionaries from '@/store/modules/dictionaries'
import classGuidance from '@/store/modules/class-guidance'
import getters from './getters'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    app,
    dict,
    user,
    im,
    homework,
    wqBook,
    exerciseCenter,
    learning,
    dailyAttendance,
    sw,
    moduleUse,
    correctEnglish,
    dictionaries,
    classGuidance
  },
  getters,
  plugins: [
    // vuex持久化配置
    createPersistedState({
      key: 'app_config_data',
      paths: ['app', 'user']
    })
  ]
})

export default store
